<?php
namespace App\Models;

class CagetoryModel extends Model
{
    protected $table = 'category';
    protected $fillable = ["id","name","pid","del","created_at","updated_at"];
    /**zwp
     * 通过产品名称，查询对应的id，可以有多个
     * @param array $arg
     * @param string $name
     * @return object
     */
    public static function getCategoryByName($arg,$name){
        return self::where("name",$name)->get($arg);
    }
    /**zwp
     * 插入产品名称，返回id
     * @param type $name
     * @return type
     */
    public static function insertNameGetId($name){
        return self::insertGetId(["name"=>$name]);
    }
    public static function getCategoryByIdRange($arg,$ids){
        return self::whereIn("id",$ids)->get($arg);
    }
}